package cz.muni.fi.pa165.musiclibrary.api.service;

import cz.muni.fi.pa165.musiclibrary.api.service.dto.IGenreDTO;
import java.util.List;

/**
* Service interface for working with genres.
* 
* @author Radoslav Stefanik 
* 2012-10-30T22:10:23+0100
*/
public interface IGenreService {
/**
     * Add new entry of given genre to database.
     * Genre could not have assigned identifier.
     *  
     * @param genre Genre (DTO) to be inserted
     * @throws TBD
     * <ul>
     *  <li>parameter is {@code null},</li>
     *  <li>genre identifier is <strong>not</strong> {@code null}.
     * </ul>
     */
    void create(final IGenreDTO genre);
    
    /**
     * Edit existing entries selected by parameter which has to have assigned
     * identifier.
     * 
     * @param genre Genre(DTO) to be updated
     * @throws IllegalArgumentException If:
     * <ul>
     *  <li>parameter is {@code null},</li>
     *  <li>genre identifier is {@code null}.
     * </ul>
     */
    void update(final IGenreDTO genre);
    
    /**
     * Remove entry by given parameter which has to have assigned identifier.
     * 
     * @param genre to be removed
     * @throws IllegalArgumentException If:
     * <ul>
     *  <li>parameter is {@code null},</li>
     *  <li>genre identifier is {@code null}.
     * </ul>
     */
    void delete(final IGenreDTO genre);
    
    /**
     * Find and return DTO object by ({@link #getIdGenre()})
     * 
     * @param idGenre defines which entry should be found
     * @return adequate entity or {@code null} if there is none for given identifier.
     */   
    IGenreDTO getById(final Long idGenre);
    
    /**
     * Return collection of all genres DTO stored in database.
     * Never returns {@code null}, if there are no 
     *  genres, returns empty list.
     * 
     * @return collection of all genres
     */
    List<IGenreDTO> getAll();
}
